#pragma once

#include "CommonEnum.h"

#include <vector>
#include <initializer_list>

struct WebAPIPermission
{
    std::string apiName; //接口的中文名称
    std::string apiModuleDesc; //对所在模块的描述，用于日志查询过滤使用

    WebAPIOperationPermission operaPermission = WebAPIOperationPermission::View; //接口的操作权限
    std::vector<std::string> moduleID; //所属模块ID 

    template<typename ...Args>
    WebAPIPermission(const std::string& apiName, const std::string& apiModuleDesc, WebAPIOperationPermission operaPermission, std::initializer_list<std::string> ls)
        :apiName(apiName), apiModuleDesc(apiModuleDesc), operaPermission(operaPermission)
    {
        for (auto& x : ls)
        {
            moduleID.push_back(x);
        }
    }

    template<typename ...Args>
    [[deprecated("need to remove")]] WebAPIPermission(WebAPIOperationPermission operaPermission, std::initializer_list<std::string> ls)  //其他地方写完就删掉这
        :operaPermission(operaPermission)
    {
        for (auto& x : ls)
        {
            moduleID.push_back(x);
        }
    }
};


